package com.example.notelite;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;

import android.content.ContentValues;
import android.content.Intent;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.view.View;
import android.widget.Adapter;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toolbar;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class MainActivity extends AppCompatActivity {
private DbRoom dbRoom;
private SQLiteDatabase dbWrite;
private static final int SEND_COBE=1111;
TextView xiugai;
EditText editText1;
TextView showtime;
String id;
ImageButton addButton;
RecyclerView full;
BaseAdapter myadaper;
ImageView gg
List<record> recordsList=new ArrayList<>();
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        xiugai=findViewById(R.id.xiugai);
        editText1=findViewById(R.id.edittext1);
        addButton=findViewById(R.id.add_button);
        showtime=findViewById(R.id.show_createtime);
        full=findViewById(R.id.full);


        setContentView(R.layout.activity_main);
        ImageButton add_button=findViewById(R.id.add_button);
       initview();

       dbRoom=new DbRoom(this);
       showData();
       add_button.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View v) {
               Intent intent=new Intent(MainActivity.this,recordActivity.class);
               startActivityForResult(intent,SEND_COBE);
           }
       });


    }

private void showData(){
        if(recordsList!=null){
            recordsList.clear();
        }
        recordsList=dbRoom.queryRecord();
        myadaper=new MyAdaper(this,recordsList);
    RecyclerView.Adapter adapter = new MyAdaper(this,recordsList);
    full.setAdapter(adapter);






}
    @Override
    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if(requestCode==SEND_COBE&&)
    }

    protected void initview(){
        full=findViewById(R.id.full);

}
}
